<template>
  <el-table :data="projectList"
            border
            height="800px"
            style="width: 100%">
    <el-table-column
        fixed
        prop="product_id"
        label="编号"
        width="70">
    </el-table-column>
    <el-table-column
        prop="product_name"
        label="项目名称"
        width="210">
    </el-table-column>
    <el-table-column
        prop="product_category"
        label="项目类别"
        width="120">
    </el-table-column>
    <el-table-column
        prop="product_intro"
        label="项目介绍"
        width="200">
    </el-table-column>
    <el-table-column
        prop="product_title"
        label="项目概要"
        width="180">
    </el-table-column>
    <el-table-column
        prop="product_price"
        label="项目金额"
        width="100">
    </el-table-column>
    <el-table-column
        fixed="right"
        label="操作"
        width="90">
      <template slot-scope="scope">
        <el-button @click="updateProject(scope.row)" type="text" size="small">编辑</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "AdminProject",
  data() {
    return {
      projectList: [],
    }
  },
  mounted() {
    this.getProjectList();
  },
  methods: {
    getProjectList() {
      this.$axios.get("/adminProject/getProjectList?role="+this.$store.getters.getUser.role).then(res => {
        this.projectList = res.data.data
      })
    },
    updateProject(row) {
      this.$router.push({
        path: "/addProject", query: {
          product_id: row.product_id,
        }
      })
    }
  }
}
</script>

<style scoped>

</style>